home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / unarced / graphics / anim / animcontrol.c < prev    next >
C/C++ Source or Header  |  1995-03-17  |  2KB  |  88 lines

  1.  
  2. /* animcontrol.c
  3.  *
  4.  *      functions for animation file manipulation
  5.  *
  6.  * This routine provided for the GrabAnim program by 
  7.  * Gary Bonham, SPARTA, Inc., Laguna Hills.
  8.  *
  9.  * This is also intended to serve as an example of how to
  10.  * generate ANIM files.
  11.  *
  12.  */
  13.  
  14. #include <exec/types.h>
  15. #include <exec/memory.h>
  16. #include <libraries/dos.h>
  17. #include <graphics/gfxbase.h>
  18. #include <graphics/rastport.h>
  19. #include <graphics/gfx.h>
  20. #include <graphics/view.h>
  21. #include "functions.h"
  22.  
  23. #include <intuition/intuition.h>
  24. #include <intuition/intuitionbase.h>
  25. #include "ilbm.h"
  26. #include "readpict.h"
  27.   
  28. extern struct BitMap *mybitmap[];
  29. static LONG fil;
  30. static UBYTE *buffer;
  31. static int Width,Height,Depth;
  32.  
  33. /* ======================================================= */
  34.  
  35. /* openanim filename */
  36. OpenAnimationFile(nbuf,cc,cm,vp)
  37. struct ViewPort *vp;
  38. struct ColorMap *cm;
  39. int nbuf;
  40. char *cc;
  41. {
  42.    fil = Open(cc,(long)MODE_NEWFILE);
  43.    if (fil == 0) puts("Cannot open animation file");
  44.    buffer = (UBYTE *)AllocMem(16000L,(long)MEMF_CHIP);
  45.    Width = mybitmap[nbuf]->BytesPerRow <<3;
  46.    Height = mybitmap[nbuf]->Rows;
  47.    printf("%d %d %d\n",Width,Height,vp->Modes);
  48.    OpenAnim(fil,mybitmap[nbuf]
  49.           , Width
  50.           , Height
  51.           , cm->ColorTable
  52.           , vp->Modes
  53.           , buffer,16000L);
  54.    return(0);
  55. }
  56.  
  57. /* addanim */
  58. AddAnimationFrame(nbuf)
  59. int nbuf;
  60. {
  61.    Width = mybitmap[nbuf]->BytesPerRow <<3;
  62.    Height = mybitmap[nbuf]->Rows;
  63.    AddAnim(mybitmap[nbuf]
  64.      , Width
  65.      , Height
  66.      , 1,buffer,16000L);
  67.    return(0);
  68. }
  69.  
  70. /* addanim */
  71. AddAnimationFrame2(data,ndata,pop)
  72. int pop;
  73. LONG *data,ndata;
  74. {
  75.    AddAnim2(data,ndata,pop);
  76.    return(0);
  77. }
  78.  
  79. /* closeanim */
  80. CloseAnimationFile()
  81. {
  82.    CloseAnim(fil);
  83.    Close(fil);
  84.    FreeMem(buffer,16000L);
  85.    fil = 0;
  86.    return();
  87. }
  88.